import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
import router from './router/index'
import Print from 'vue3-print-nb'
/* 自定义指令 */
import directive from '@/directive';

/* ElementPlus组件相关的配置 */
import ElementPlus from 'element-plus'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import 'element-plus/dist/index.css'

import { axiosConfig } from './utils/axiosConfig'
import { routerConfig } from './utils/routerConfig'
/* 阿里图标库 */
import './assets/css/icon.css';
import './assets/font/iconfont.css';

// 生效axios配置文件
axiosConfig();
// 生效router配置文件
routerConfig();
const app = createApp(App);

directive(app);
app
  .use(createPinia())
  .use(router)
  .use(ElementPlus, { size: 'default', locale: zhCn })
  .use(Print)

// 注册elementplus图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.mount('#app');